package sistemas.deudores;

/**
 *
 * @author Emmanuel Arias
 */
import java.sql.*;

public class DataBase {

    String bd = "sisdeudores";
    String user = "root";
    String password = "EmmyLove";
    public static Connection connection;
    public static Statement stmt;
    public void Conectar() {
        connection = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            String servidor = "jdbc:mysql://localhost/" + bd;
            connection = DriverManager.getConnection(servidor, user, password);
            stmt = (Statement)this.connection.createStatement();
            System.out.println("Se conecto correctamente a la base de datos");
        } catch (SQLException | ClassNotFoundException ex) {
            System.out.println(ex);
        }
    }

    public void Desconectar() {
        try {
            connection.close();
            System.out.println("Se desconecto correctamente de la base de datos");
        } catch (SQLException ex) {
            System.out.println(ex);
        }
    }
}
